package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.Cart;
import com.ruoyi.system.api.factory.RemoteCartFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * 购物车服务
 */
@FeignClient(contextId = "remoteCartService", value = ServiceNameConstants.CART_SERVICE, fallbackFactory = RemoteCartFallbackFactory.class)
public interface RemoteCartService {
    /**
     * 通过购物车编号查询购物车信息
     *
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/cart/{cartId}")
    R<Cart> getByCartId(@PathVariable("cartId") Long cartId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


}
